Historically, nursing homes were functionally similar, caring for impaired residents with a range of underlying health conditions largely drawn from the local community. Over time, however, homes have specialized in the treatment of particular types of chronically ill residents. In particular, some homes now specialize in the treatment of residents with dementia and/or severe mental illness. This specialization occurs both by treating a high volume of residents with these conditions and also through dedicated units and facilities. The literature to date on specialization in nursing home care has largely been confounded by differential selection into more and less specialized settings. The type of resident who is admitted to a dementia special care unit (SCU), for example, may be quite different in many unobserved ways from the resident who is admitted to a non-SCU facility. If so, simple comparisons of quality of SCU and non-SCU settings, controlling for observable characteristics, may yield misleading estimates. When randomization is not feasible, as in this case, social scientists have applied instrumental variables methods to account for unobserved differences across study populations. One instrument that has been frequently and successfully used in health care, including in the PI's prior nursing home research, is the differential distance from the patient's home to different providers. Using instrumental variables methods, the research proposed here seeks to test hypotheses pertinent to the question of whether specialization by nursing homes in the treatment of mental illness or dementia improves outcomes. We focus on these two conditions because of their prevalence and the observed specialization by nursing homes in the treatment of these populations. Thus, these conditions provide an ideal opportunity to study the positives and negatives of nursing home specialization. In Aim 1, we investigate the within and between-facility variation in care for persons with dementia or mental illness in nursing homes. That is, across homes and within a home, do persons with dementia and mental illness receive comparable quality of care? Aim 2 focuses on the independent effect of specialization on quality. If specialization is associated with expertise, this specialization wll improve care, if it is associated with worse care being offered to a disadvantaged population, the effect of specialization will be negative. Aim 3 recognizes that the care of persons with mental illness or dementia may exhibit externalities. We quantify the spillovers in quality for car of other residents. In all three Aims, we focus on empirical indicators of quality of care, measured by process and outcome indicators, for both general and mental health care. We use the powerful national 1999-2011 Minimum Data Set (MDS) assessments of nursing home residents merged with Medicare claims data. By providing the best evidence to date on specialization in the treatment of residents with mental illness and dementia, this proposal has the potential to greatly improve the quality of care for the millions of residents with dementia an mental illness that will be treated in U.S. nursing homes in the coming decade.